﻿using DataScripter.Database;
using DataScripter.Scripting;
using DataScripter.Scripting.Query.SqlServer;
using DataScripter.Scripting.ScriptDefinitions;
using DataScripter.UnitTests.Factories;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace DataScripter.UnitTests.DataProducerTests
{
    [TestClass]
    public class WhenNoFilterHasBeenApplied
    {
        private readonly string _query;

        public WhenNoFilterHasBeenApplied()
        {
            Mock<Db> dbMock = new Mock<Db>("", "");
            DataProducer dataProducer = new DataProducer(dbMock.Object);

            Engine engine = new Engine();
            IScriptDefinition scriptDefinition = new ScriptDefinition("", engine);
            ITableScriptRequest tableScriptRequest = scriptDefinition.InstallScriptRequest("abc");

            _query = dataProducer.ProduceQuery(tableScriptRequest);
        }

        [TestMethod]
        public void QueryShouldBeCorrect()
        {
            Assert.AreEqual("SELECT * FROM abc", _query);
        }
    }
}
